package dailytest;

import java.text.Collator;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;

/**
 * @author: heweiwei
 * @Date: 2023/11/17 18:27
 * @Desc:
 */
public class TestHbosSort {

    public static void main(String[] args) {



        PrintDispenseMedicationSummaryDetailDTO one=new PrintDispenseMedicationSummaryDetailDTO();
        one.setName("");
        one.setCabinetName("C8");
        one.setCargoSpaceNo("17");


        PrintDispenseMedicationSummaryDetailDTO two=new PrintDispenseMedicationSummaryDetailDTO();
        two.setName("");
        two.setCabinetName("D1");
        two.setCargoSpaceNo("01");



        PrintDispenseMedicationSummaryDetailDTO three=new PrintDispenseMedicationSummaryDetailDTO();
        three.setName("");
        three.setCabinetName("D1");
        three.setCargoSpaceNo("02");

        PrintDispenseMedicationSummaryDetailDTO four=new PrintDispenseMedicationSummaryDetailDTO();
        four.setName("");
        four.setCabinetName("D1");
        four.setCargoSpaceNo("03");

        PrintDispenseMedicationSummaryDetailDTO five=new PrintDispenseMedicationSummaryDetailDTO();
        five.setName("");
        five.setCabinetName("C1");
        five.setCargoSpaceNo("03");


        List<PrintDispenseMedicationSummaryDetailDTO> list = Arrays.asList(four,one, three,five,two);


        list = list.stream().sorted((i1, i2) -> {
                return Collator.getInstance(Locale.CHINESE).compare(i1.getCabinetName().concat("-").concat(i1.getCargoSpaceNo()), i2.getCabinetName().concat("-").concat(i2.getCargoSpaceNo()));
        }).collect(Collectors.toList());


        System.out.println("list = " + list);

    }



}
